﻿#ifndef APPCAST_H
#define APPCAST_H

#include <QString>

enum CastType
{
    BroadCast_type = 0,
    MutiCast_type = 1,
    UniCast_type = 2,
};

enum ERRORCODE
{
    COMM_OK = 0,
    ERR_NO_MEMORY = -(COMM_OK +1),
    ERR_CREATE_SOCKET = -(COMM_OK +2), //创建套接字失败
    ERR_BIND          = -(COMM_OK + 7),  //绑定失败
    ERR_JOIN_MUTICAST_GROUP = -(COMM_OK +8), //加入广播组失败
    ERR_CONNECT= -(COMM_OK +3),
    ERR_SEND= -(COMM_OK +4),
    ERR_RECV= -(COMM_OK +5),
    ERR_DISCONNECT= -(COMM_OK +6),
};
QString& getErroMsg(int errorCode);


QString HexToAscII(const QString &hexStr);
QString HexToAscii(QString text);
QString AsciiToHex(QString text);



//class ErrorCode{
//    ErrorCode(ERRORCODE errno): errorCode(errno){

//    }
//    ~ErrorCode();

//public:
//    QString &getErrorMessage(ERRORCODE errno);

//private:
//    ERRORCODE errorCode;
//    QString ErrorMessage;

//};

#endif // APPCAST_H
